package com.coolbi.onsupai.core.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;

import com.coolbi.onsupai.core.dao.FranchiserFundDao;
import com.coolbi.onsupai.core.entity.FranchiserFund;
import com.coolbi.onsupai.core.mapper.FranchiserFundMapper;

public class FranchiserFundDaoImpl implements FranchiserFundDao{
	
	@Autowired
	private FranchiserFundMapper franchiserFundMapper;
	
	public void setFranchiserFundMapper(FranchiserFundMapper franchiserFundMapper) {
		this.franchiserFundMapper = franchiserFundMapper;
	}

	@Override
	public FranchiserFund save(FranchiserFund obj) {
		franchiserFundMapper.save(obj);
		return obj;
	}

	@Override
	public int delete(long id) {
		return franchiserFundMapper.delete(id);
	}

	@Override
	public int update(FranchiserFund obj) {
		return franchiserFundMapper.update(obj);
	}

	@Override
	public FranchiserFund get(long id) {
		return franchiserFundMapper.get(id);
	}

	@Override
	public List<FranchiserFund> list() {
		return franchiserFundMapper.list();
	}

	@Override
	public List<FranchiserFund> listByPage(int offset, int limit) {
		Map<String,Object>parameter=new HashMap<String,Object>();
		parameter.put("offset", offset);
		parameter.put("limit",limit);
		return franchiserFundMapper.listByPage(parameter);
	}

	@Override
	public List<FranchiserFund> find(Map<String, Object> parameter) {
		return franchiserFundMapper.listByParameter(parameter);
	}

	@Override
	public List<FranchiserFund> findByPage(Map<String, Object> parameter,
			int offset, int limit) {
		parameter.put("offset", offset);
		parameter.put("limit", limit);
		return franchiserFundMapper.listByParameterPage(parameter);
	}

	@Override
	public List<FranchiserFund> search(Map<String, Object> parameter, int offset,
			int limit) {
		parameter.put("offset", offset);
		parameter.put("limit", limit);
		return franchiserFundMapper.search(parameter);
	}

	@Override
	public int count() {
		return franchiserFundMapper.count();
	}

	@Override
	public int countByKeyWord(Map<String, Object> parameter) {
		return franchiserFundMapper.countByKeyWord(parameter);
	}

	@Override
	public int count(Map<String, Object> parameter) {
		return franchiserFundMapper.countByParameter(parameter);
	}

	@Override
	public int countByAccountNo(String accountNo) {
		return franchiserFundMapper.countByAccountNo(accountNo);
	}

	@Override
	public int updateStatus(Long id, Boolean accountStatus) {
		Map<String, Object> parameter = new HashMap<String, Object>();
		parameter.put("id", id);
		parameter.put("accountStatus", accountStatus);
		return franchiserFundMapper.updateStatus(parameter);
	}

}
